#include <pthread.h> 
#include <stdio.h> 
#include <stdlib.h>
#define NUM_THREADS	4

void* PrintHello(void* null) 
{ 
	printf("Hello World!\n"); 
	pthread_exit(NULL); 
} 
 
int main (int argc, char* argv[]) 
{ 
	pthread_t threads[NUM_THREADS]; 
	int rc=-1, t; 
	for(t=0; t<NUM_THREADS; t++){ 
		printf("In main: creating thread %d\n", t); 
		//your code here
		rc = pthread_create(&threads[t], NULL, PrintHello, NULL); 
		//end of your code
		if (rc){ 
			printf("ERROR; return code from pthread_create() is %d\n", rc); 
			exit(-1); 
		} 
	} 
	pthread_exit(NULL); 
} 

/*
编译：gcc 1.Pthreads的创建和终止.c  -pthread
*/